package com.aoxin.service.impl.course.webCourse;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import com.aoxin.mapper.SlfActivityMapper;
import com.aoxin.model.SlfActivity;
import com.aoxin.service.inter.course.webCourse.ActivityService;
import com.aoxin.util.ErrorUtil;

@Service
public class ActivityServiceImpl implements ActivityService {

    @Autowired
    private SlfActivityMapper slfActivityMapper;

    @Override
    @Transactional
    public Integer deleteSlfactivity(List<Integer> activityId) {
        Assert.notNull(activityId,String.format(ErrorUtil.SLFACTIVITY,"activityId"));
        Integer integer=0;
        if(activityId !=null){
            integer=slfActivityMapper.deleteSlfactivity(activityId);
        }
        return integer;
    }

    @Override
    @Transactional
    public Integer insertSlfactivity(SlfActivity slfActivity) {
        Assert.notNull(slfActivity,String.format(ErrorUtil.SLFACTIVITYRULE,"slfActivity"));
        Integer integer=0;
        if(slfActivity !=null){
           integer= slfActivityMapper.insertSlfactivity(slfActivity);
        }
        return integer;
    }

    @Override
    public List<SlfActivity> getSlfactivity(SlfActivity slfActivity) {
        Assert.notNull(slfActivity,String.format(ErrorUtil.SLFACTIVITY,"slfActivity"));
        List<SlfActivity> list = slfActivityMapper.getSlfactivity(slfActivity);
        return list;
    }

    @Override
    @Transactional
    public Integer updateSlfactivity(SlfActivity slfActivity) {
        Assert.notNull(slfActivity,String.format(ErrorUtil.SLFACTIVITY,"slfActivity"));
        Integer integer=0;
        if (slfActivity !=null){
            integer=slfActivityMapper.updateSlfactivity(slfActivity);
        }
        return integer;
    }

    @Override
    public List<SlfActivity> getBySlfactivity(SlfActivity slfActivity) {
        List<SlfActivity> list=slfActivityMapper.getBySlfactivity(slfActivity);
        return list;
    }
}
